(function () {
    let init = echarts.init(document.querySelector('#pie'));
    let option = {
        color: ['#f9ba33', '#24b6c0', '#66c59d', '#00e517',
            '#a200f8'
            , '#0050ff'],
        grid: {
            top: '50px',
            bottom: '50px',
            left: '50px',
            right: '30px'
        },
        tooltip: {
            trigger: 'item'
        },
        legend: {
            // 距离容器10%
            right: "10%",
            orient: 'vertical',
            top: '15%',
            // 修饰图例文字的颜色
            textStyle: {
                color: "rgba(255,255,255,.7)",
                fontSize: 12
            }
            // 如果series 里面设置了name，此时图例组件的data可以省略
            // data: ["邮件营销", "联盟广告"]
        },
        series: {
            type: 'pie',
            center: ['40%', '59%'],
            radius: ['15%', '60%'],
            label: {
                normal: {formatter: '{b} :\n{c}({d}%)', fontSize: 12}
            },
            emphasis: {},
            data: []
        }
    }
    let fontChange = function (baseSize) {
        option.legend.textStyle.fontSize = Number((0.785 * baseSize).toFixed(0));
        option.series.label.normal.fontSize = Number((0.63 * baseSize).toFixed(0));
        return option;
    }
    resizeCallBack.push({chart: init, fontChange: fontChange})
    let updateFun = function (data) {
        option.series.data = data;
        init.setOption(option);
    };
    if (charts1) {
        charts1['33'] = updateFun;
    }
})()